<%@page import="net.tanesha.recaptcha.ReCaptchaFactory"%>
<%@page import="net.tanesha.recaptcha.ReCaptcha"%>
<%@page import="articles.model.Category"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html;charset=UTF-8" language="java"%>

<%
	List<Category> list_category = (List<Category>)request.getAttribute("list_category");
	String[] check = (String[]) request.getAttribute("check");
	String[] data = (String[]) request.getAttribute("data");
	String title = (String) request.getAttribute("title");
	String description = (String) request.getAttribute("description");
	String keywords = (String) request.getAttribute("keyword");
	List<Category> category = (List<Category>)request.getAttribute("category");
%>
<jsp:include page="layout/header.jsp">
	<jsp:param name="title" value="<%=title %>"/>
	<jsp:param name="description" value="<%=description %>"/>
	<jsp:param name="keywords" value="<%=keywords %>"/>
</jsp:include>

<div id="content">
	<div id="leftsidecontent">
		<h2>Submit An Article</h2>
				
				<hr size="1"/>
				<p>Submit your article to <b>Yooarticles.com</b> by filling up the form below. Please include a brief bio of yourself that highlights your field of expertise, experience, company name (if any), web site address and your e-mail address. These info will be used for the "About The Author" box. Please also take time to read the Author's Agreement before submitting your article.</p>	
				<hr size="1"/>
				<form action="/post-articles" method="post">
					<ul class="submit">
						<li>
							<h3>Author's Full Name:</h3>
							<input name="author" type="text" value="<%=(data[0] != null)?data[0]:"" %>" <%=(check[0] != null)?"style='border:1px solid red;'":"" %>/>
							<%=(check[0] != null)?"<p style='color:red;'>"+check[0]+"</p>":"" %>
						</li>
						<li>
							<h3>Author's E-mail Address:</h3>
							<input name="email" type="text" value="<%=(data[1] != null)?data[1]:"" %>" <%=(check[4] != null)?"style='border:1px solid red;'":"" %>/>
							<%=(check[4] != null)?"<p style='color:red;'>"+check[4]+"</p>":"" %>
						</li>
						<li>
							<h3>Article Title:</h3>
							<input name="title" type="text" value="<%=(data[2] != null)?data[2]:"" %>" <%=(check[5] != null || check[6] != null)?"style='border:1px solid red;'":"" %>/>
							<%=(check[5] != null)?"<p style='color:red;'>"+check[5]+"</p>":"" %>
							<%=(check[6] != null)?"<p style='color:red;'>"+check[6]+"</p>":"" %>
						</li>
						<li>
							<h3>Place this Article under what Category? </h3>
							<select size="6" name="categoryAlias" <%=(check[1] != null)?"style='border:1px solid red;'":"" %>>
								<option value="" selected="selected">Choose one</option>
								<option value="">---------------------------------------------------------------------</option>
								<%
									if(list_category.size()>0)
									{
										for(int i=0;i<list_category.size();i++)
										{
											if(data[3] != null && data[3].equals(list_category.get(i).getAlias()))
											{
												out.println("<option value='"+list_category.get(i).getAlias()+"' selected='selected'>"+list_category.get(i).getName()+"</option>");
											} else {
												out.println("<option value='"+list_category.get(i).getAlias()+"'>"+list_category.get(i).getName()+"</option>");
											}
										}
									}
								%>
							</select>
							<%=(check[1] != null)?"<p style='color:red;'>"+check[1]+"</p>":"" %>
						</li>
						<li>
							<h3>Content:</h3>
							<textarea class="a_c" name="content" <%=(check[2] != null)?"style='border:1px solid red;'":"" %>><%=(data[5] != null)?data[5]:""%></textarea>
							<%=(check[2] != null)?"<p style='color:red;'>"+check[2]+"</p>":"<p>Minimum 500 charracter</p>" %>
						</li>
						<li>
							<h3>Keyword: </h3>
							<input name="keyword" type="text" value="<%=(data[6] != null)?data[6]:"" %>"/>
							<p>Maximum 5 keyword, example:keyword1,keyword2,...</p>
						</li>
						<li>
							<h3>Author's Web Site Address: </h3>
							<input name="link" type="text" value="<%=(data[7] != null)?data[7]:"" %>"/>
						</li>
						<li>
							<h3>Link Video: </h3>
							<input name="linkEmbed" type="text" value="<%=(data[8] != null)?data[8]:"" %>"/>
						</li>
						<li>
							<script>
					        	var RecaptchaOptions = { theme : 'clean' };
					  		</script>
							<%
								//6LdXmcISAAAAAHz6FsABghup-EayldUCiKQyDPAk //public
								//6LdXmcISAAAAANPIv5ykGg3LAlBMnUQHzy3-Kiqo //private
					          ReCaptcha c = ReCaptchaFactory.newReCaptcha("6LffrtMSAAAAAKLM_qZfpkaRafrM2fI1ngG3uASQ", "6LffrtMSAAAAAC3AFK7lc5mu6-lHcq0Z99o6ltXQ", false);
					          out.print(c.createRecaptchaHtml(null, null));
					        %>
					        <%=(check[7] != null)?"<p style='color:red;'>"+check[7]+"</p>":"" %>
						</li>
						<li>
							<input type="submit" value="Submit Articles"/>
							<jsp:include page="element/adv_four.jsp"></jsp:include>
						</li>
					</ul>
				</form>
	</div>
	<div id="rightsidecontent">
		<jsp:include page="element/google_search.jsp"></jsp:include>
		<jsp:include page="element/hatforrent.jsp"></jsp:include>
		<jsp:include page="element/adv_two.jsp"></jsp:include>
		<jsp:include page="element/left.jsp"></jsp:include>

		<jsp:include page="element/fanpage.jsp"></jsp:include>

		
	</div>
	<div class="clearbreak"></div>
</div>
<script type="text/javascript" src="/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript" src="/js/mi_submit.js"></script>
<%@ include file='/layout/footer.jsp'%>   